
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
string-random
Advanced tools
Generate random string
string-random is available as an npm package.
npm i string-random
{number} the length of the result, default 8
{boolean|object} default {}, true=={specials: true}
{boolean|string} should contain numbers, default true, if is string, only contain assigned numbers.
{boolean|string} should contain letters, default true, if is string, only contain assigned letters.
{boolean|string} should contain specials, default false, if is string, only contain assigned specials.
const random = require('string-random');
//import random from 'string-random';
console.log(random()); //jcBvYzfa
console.log(random(16)); //d9oq0A3vooaDod8X
console.log(random(16, {numbers: false})); //AgfPTKheCgMvwNqX
console.log(random(16, {letters: false})); //0889014544916637
console.log(random(16, {letters: 'ABCDEFG'})); //055B1627E43GA7D8
console.log(random(16, {specials: true})); //,o=8l{iay>AOegW[
console.log(random(16, {specials: true, numbers: false, letters: false})); //)-[+$^%+$|)-{(]%
console.log(random(16, {specials: ':;', numbers: false, letters: false})); //:;:;;;:;;;;;;;::
console.log(random(16, true)); //SMm,EjETKMldIM/J
This project is licensed under the terms of the MIT license
FAQs
Generate random string
The npm package string-random receives a total of 16,620 weekly downloads. As such, string-random popularity was classified as popular.
We found that string-random demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.